#ifndef HTTPS_H
#define HTTPS_H

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>

extern QString Server;

class Https : public QObject
{
    Q_OBJECT
public:
    explicit Https(QObject *parent = nullptr);
    void parseJsonObject(const QJsonObject& obj);
signals:
    void loginResponse(const QJsonObject&obj);
    void albumInfoReady(const QJsonObject&obj);
    void songInfoReady(const QJsonObject&obj);
    void searchInfoReady(const QJsonObject&obj);
    void albumidReady(qint64 id);
public slots:
    void login(const QString&username,const QString&password);
    void sendGetRequest(const QString &url);
    void sendPostRequest(const QString &url, const QJsonObject &jsonData);
    void sendPutRequest(const QString &url, const QJsonObject &jsonData);
    void sendDeleteRequest(const QString &url);


private slots:
    void onFinished(QNetworkReply *reply);

private:
    QNetworkAccessManager *networkManager;
};

#endif // HTTPS_H
